
#ifndef __QUAD_H__
#define __QUAD_H__

#include "Real3.h"
#include "Real2.h"
#include <vector>

using namespace std;

class Vertex;

class Quad
{
public:

	// Constructor
	Quad() {}
	Quad(uint _a, uint _b, uint _c, uint _d);

	// Set
	void Set(uint _a, uint _b, uint _c, uint _d);

	// Updates copies
	void Update2s();

	// Indices
#ifdef BUFFER_BIT_16
	ushort a;
	ushort b;
	ushort c;

	ushort a2;
	ushort c2;
	ushort d;
#else
	uint a;
	uint b;
	uint c;

	uint a2;
	uint c2;
	uint d;
#endif

	// Calculated Midpoints
	Real3 MidPoint(vector<Vertex> *vertices) const;
	Real3 Side0MidPoint(vector<Vertex> *vertices) const;
	Real3 Side1MidPoint(vector<Vertex> *vertices) const;
	Real3 Side2MidPoint(vector<Vertex> *vertices) const;
	Real3 Side3MidPoint(vector<Vertex> *vertices) const;

	// Calculated Normals
	Real3 Normal(vector<Vertex> *vertices) const;
	Real3 Side0Normal(vector<Vertex> *vertices) const;
	Real3 Side1Normal(vector<Vertex> *vertices) const;
	Real3 Side2Normal(vector<Vertex> *vertices) const;
	Real3 Side3Normal(vector<Vertex> *vertices) const;

	// Calculated Texture Coordinates
	Real2 Tex(vector<Vertex> *vertices) const;
	Real2 Side0Tex(vector<Vertex> *vertices) const;
	Real2 Side1Tex(vector<Vertex> *vertices) const;
	Real2 Side2Tex(vector<Vertex> *vertices) const;
	Real2 Side3Tex(vector<Vertex> *vertices) const;
};

#endif // __QUAD_H__